package friendsbtt.core.lang;

import java.util.HashMap;

import friendsbtt.core.Log;

public class ResourceResolver {
	private HashMap<String, TypeResolver<?>> resources;
	
	private static ResourceResolver instance = new ResourceResolver();
	
	private ResourceResolver(){
		this.resources = new HashMap<String, TypeResolver<?>>();
	}
	
	public static void add(TypeResolver<?> unitOfWork){
		instance.resources.put(unitOfWork.getGenericType().getClass().getName(), unitOfWork);
	}
	
	public static <T> T get(Class<?> t){
		
		return (T) instance.resources.get(t.getName()).getResolvedType();
	}
}
